<?php
	class xl_loaitrang extends database
	{
		function LoadAll()
		{
			$sql = "Select * from loaitrang";
			$this->setQuery($sql);
			$arr = $this->loadAllRow();
			$this->disconnect(); 
			return $arr;
		}
		
		function LayLoaiTrangTheoMa($maloaitrang)
		{
			$sql = "Select * from loaitrang where maloaitrang='".$maloaitrang."'";
			$this->setQuery($sql);
			$arr = $this->loadOneRow();
			$this->disconnect(); 
			return $arr;
		}
		
		function Load_TrangChu()
		{
			$sql = "Select * from loaitrang where maloaitrang = '1'";
			$this->setQuery($sql);
			$arr = $this->loadOneRow();
			$this->disconnect(); 
			return $arr;
		}
		
		function Load_HotLine()
		{
			$sql = "Select * from loaitrang where maloaitrang = '11'";
			$this->setQuery($sql);
			$arr = $this->loadOneRow();
			$this->disconnect(); 
			return $arr;
		}
		
		function Load_ThongDiep()
		{
			$sql = "Select * from loaitrang where maloaitrang = '13'";
			$this->setQuery($sql);
			$arr = $this->loadOneRow();
			$this->disconnect(); 
			return $arr;
		}
		
		function Load_TuKhoa()
		{
			$sql = "Select * from loaitrang where maloaitrang = '4'";
			$this->setQuery($sql);
			$arr = $this->loadOneRow();
			$this->disconnect(); 
			return $arr;
		}
		//Toan - MOD START - 29/02/2012
		function capnhat($maloaitrang,$noidung,$tags,$mota)
		{
			$sql = "UPDATE loaitrang set noidung ='".$noidung."', tags ='".$tags."', mota ='".$mota."' where maloaitrang=".$maloaitrang;		
			$this->setQuery($sql);
			return $this->query(); 
			//return $sql;
		}
		
		//Toan - MOD END - 29/02/2012
		function capnhap1($mauser,$hoten,$tendangnhap,$matkhau,$diachi,$dienthoai,$currentDate,$email)
		{
			$sql = "UPDATE nguoidung set tendangnhap='".$tendangnhap."', matkhau ='".$matkhau."', ngaytao ='".$currentDate."', email ='".$email."', hoten ='".$hoten."',diachi='".$diachi."',dienthoai='".$dienthoai."' where manguoidung=".$mauser;
			$this->setQuery($sql);
			return $this->query(); 
			//return $sql;
		}
		
		function them($matkhau,$hoten,$tendangnhap,$diachi,$dienthoai,$currentDate,$email)
		{
			$sql = "INSERT INTO nguoidung (hoten,tendangnhap,matkhau,diachi,dienthoai,ngaytao,email) VALUES ('".$hoten."','".$tendangnhap."','".$matkhau."','".$diachi."','".$dienthoai."','".$currentDate."','".$email."')";
			$this->setQuery($sql);
			return $this->query();
			//return $sql;
			
		}
		function xoa_user($mauser)
		{
			$sql ="delete from nguoidung where manguoidung = '".$mauser."'";
			$this->setQuery($sql);
			return $this->query();
		}
		
		//Toan - ADD - 20/2/2012
		function Load_GioiThieu()
		{
			$sql = "Select * from loaitrang where maloaitrang = '2'";
			$this->setQuery($sql);
			$arr = $this->loadOneRow();
			$this->disconnect(); 
			return $arr;
		}
		
		function Load_LienHe()
		{
			$sql = "Select * from loaitrang where maloaitrang = '3'";
			$this->setQuery($sql);
			$arr = $this->loadOneRow();
			$this->disconnect(); 
			return $arr;
		}
		function Load_TuyenDung()
		{
			$sql = "Select * from loaitrang where maloaitrang = '15'";
			$this->setQuery($sql);
			$arr = $this->loadOneRow();
			$this->disconnect(); 
			return $arr;
		}
		//Toan - ADD END - 20/2/2012
		
	}
?>